/*
 * @Author: szx
 * @Date: 2022-05-18 12:44:10
 * @LastEditTime: 2022-05-18 13:19:06
 * @Description:
 * @FilePath: \leetcode\600-699\668\668.js
 */
/**
 * @param {number} m
 * @param {number} n
 * @param {number} k
 * @return {number}
 */
var findKthNumber = function (m, n, k) {
    let left = 1,
        right = m * n;
    while (left < right) {
        const x = left + ((right - left) >> 1);
        let count = Math.floor(x / n) * n;
        for (let i = Math.floor(x / n) + 1; i <= m; ++i) {
            count += Math.floor(x / i);
        }
        if (count >= k) {
            right = x;
        } else {
            left = x + 1;
        }
    }
    return left;
};
